<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>

</body>
</html>
<script>
  // const text = '123/'
  const text = '123//'
  console.log(text.charAt(text.length - 1) === '/' ? text.slice(0, -1) : text)
</script>